#ifndef _H_SERVICE_DELEGATE_H_
#define _H_SERVICE_DELEGATE_H_

#include "../CTypeDefine.h"
#ifdef _USING_CLI
#else
#include <functional>
#endif
#include "../SmartPtrDefine.h"

namespace QWER
{
	QCLASS IApplication;
	QCLASS IService;

#ifdef _USING_CLI
	QDLL_EXPORT delegate PTR(CPromise) DToServiceAdapterRpcReply(PTR(IServiceBackend) roResolver, PTR(IToServiceAdapterRpc) roRpc);
	QDLL_EXPORT delegate PTR(CPromise) DToServiceResolverRpcReply(PTR(IServiceFrontend) roAdapter, PTR(IToServiceResolverRpc) roRpc);
	QTEMPLATE<typename T> QWHERE(T: IServiceBackend)
	QDLL_EXPORT delegate T DNewServiceBackend();
	QTEMPLATE<typename T> QWHERE(T: IServiceFrontend)
	QDLL_EXPORT delegate T DNewServiceFrontend();
#else
	QTEMPLATE<typename T> QWHERE(T: IServiceBackend)
	using DNewServiceBackend = std::function<CUniquePtr(T)(PTR(IService))>;
	QTEMPLATE<typename T> QWHERE(T: IServiceFrontend)
	using DNewServiceFrontend = std::function<CUniquePtr(T)(PTR(IService))>;
	using DNewApplication = std::function<CUniquePtr(IApplication)()>;
    using DRunnerUpdateFunc = std::function<UINT32()>;
#endif
}

#endif
